home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / math / ast53src.zip / ASTROLOG.H < prev    next >
C/C++ Source or Header  |  1996-09-29  |  51KB  |  1,446 lines

  1. /*
  2. ** Astrolog (Version 5.30) File: astrolog.h
  3. **
  4. ** IMPORTANT NOTICE: The graphics database and chart display routines
  5. ** used in this program are Copyright (C) 1991-1996 by Walter D. Pullen
  6. ** (Astara@msn.com, http://www.magitech.com/~cruiser1/astrolog.htm).
  7. ** Permission is granted to freely use and distribute these routines
  8. ** provided one doesn't sell, restrict, or profit from them in any way.
  9. ** Modification is allowed provided these notices remain with any
  10. ** altered or edited versions of the program.
  11. **
  12. ** The main planetary calculation routines used in this program have
  13. ** been Copyrighted and the core of this program is basically a
  14. ** conversion to C of the routines created by James Neely as listed in
  15. ** Michael Erlewine's 'Manual of Computer Programming for Astrologers',
  16. ** available from Matrix Software. The copyright gives us permission to
  17. ** use the routines for personal use but not to sell them or profit from
  18. ** them in any way.
  19. **
  20. ** The PostScript code within the core graphics routines are programmed
  21. ** and Copyright (C) 1992-1993 by Brian D. Willoughby
  22. ** (brianw@sounds.wa.com). Conditions are identical to those above.
  23. **
  24. ** The extended accurate ephemeris databases and formulas are from the
  25. ** calculation routines in the program "Placalc" and are programmed and
  26. ** Copyright (C) 1989,1991,1993 by Astrodienst AG and Alois Treindl
  27. ** (alois@azur.ch). The use of that source code is subject to
  28. ** regulations made by Astrodienst Zurich, and the code is not in the
  29. ** public domain. This copyright notice must not be changed or removed
  30. ** by any user of this program.
  31. **
  32. ** Initial programming 8/28,30, 9/10,13,16,20,23, 10/3,6,7, 11/7,10,21/1991.
  33. ** X Window graphics initially programmed 10/23-29/1991.
  34. ** PostScript graphics initially programmed 11/29-30/1992.
  35. ** Last code change made 9/22/1996.
  36. */
  37.  
  38. /*
  39. ** TO COMPILE: For most systems, especially Unix, DOS, and Macs, the only
  40. ** changes that should need to be made to the code are to edit or comment the
  41. ** #define's below to equal the particulars of your own system and locale:
  42. **
  43. ** SYSTEM SECTION: These settings describe platform and hardware specifics.
  44. ** They are all required to be set properly or the program likely won't
  45. ** compile or run. Some of these are technically optional and can be
  46. ** commented out even if your system would normally support them, e.g.
  47. ** the X11 graphics can be disabled even if you are running X windows.
  48. */
  49.  
  50. #define PC /* Comment out this #define if you have a Unix, Mac, or other */
  51.            /* system that isn't a generic PC running DOS or MS Windows.  */
  52.  
  53. /*#define MAC /* Comment out this #define if you're not compiling for a Mac. */
  54.  
  55. /*#define X11 /* Comment out this #define if you don't have X windows, or */
  56.             /* else have them and don't wish to compile in X graphics.  */
  57.  
  58. #define WIN /* Comment out this #define if you don't have MS Windows, or */
  59.             /* else have them but want to compile a DOS version instead. */
  60.  
  61. /*#define MSG /* Comment out this #define if you don't have access to the     */
  62.             /* Microsoft C PC graphics library as in graph.h, or you do and */
  63.             /* have a PC and just don't wish to compile these graphics in.  */
  64.  
  65. /*#define BGI /* Comment out this #define if you don't have access to the  */
  66.             /* Borland C BGI graphics library for PC's in graphics.h, or */
  67.             /* you do and just don't wish to compile such graphics in.   */
  68.  
  69. /*#define MACG /* Comment out this #define if you don't have a Mac, or else  */
  70.              /* have one and don't wish to compile in Mac screen graphics. */
  71.  
  72. #define MOUSE /* Comment out this #define if you don't have a mouse, or    */
  73.               /* don't wish to compile in mouse tracking features. This is */
  74.               /* only valid if X11, WIN, MSG, BGI, or MACG above are set.  */
  75.  
  76. #define TIME /* Comment out this #define if your compiler can't take the  */
  77.              /* calls to the 'time' or 'localtime' functions as in time.h */
  78.  
  79. #define SWITCHES /* Comment out this #define if your system can not handle */
  80.                  /* parameters on the command line (such as Mac's).        */
  81.  
  82. #define ENVIRON /* Comment out this #define if your system doesn't have  */
  83.                 /* environment variables or can't compile calls to them. */
  84.  
  85. /*#define ATOF /* Comment out this #define if you have a system in which  */
  86.              /* 'atof' and related functions aren't defined in stdio.h, */
  87.              /* such as most PC's, Linux, VMS compilers, and NeXT's.    */
  88.  
  89. #define PROTO /* Comment out this #define if you have an older compiler   */
  90.               /* which doesn't allow full Ansi function prototypes. This  */
  91.               /* is for programmers only and has no effect on executable. */
  92.  
  93. /*
  94. ** FEATURES SECTION: These settings describe features that are always
  95. ** available to be compiled into the program no matter what platform or
  96. ** hardware is available. Their settings are always optional.
  97. */
  98.  
  99. #define GRAPH /* Comment out this #define if you don't want any graphics   */
  100.               /* in the program. This switch allows at least generation of */
  101.               /* bitmap files and must be set if any of the more advanced  */
  102.               /* graphics feature additions are also compiled in.          */
  103.  
  104. #define PLACALC /* Comment out this #define if you don't want the more */
  105.                 /* accurate calculation features and formulas to be    */
  106.                 /* compiled into the program (as accessed with -b).    */
  107.  
  108. #define PS /* Comment out this #define if you don't want the ability to */
  109.            /* generate charts in the PostScript graphics format.        */
  110.  
  111. #define META /* Comment out this #define if you don't want the ability to  */
  112.              /* generate charts in the MS Windows metafile picture format. */
  113.  
  114. #define INTERPRET /* Comment out this #define if you don't want the ability */
  115.                   /* to display interpretations of the various chart types. */
  116.  
  117. #define ARABIC /* Comment out this #define if you don't want any chart     */
  118.                /* lists that include Arabic parts included in the program. */
  119.  
  120. #define CONSTEL /* Comment out this #define if you don't want any of the */
  121.                 /* astronomical constellation charts in the program.     */
  122.  
  123. #define BIORHYTHM /* Comment out this #define if you don't want the    */
  124.                   /* non-astrological biorhythm charts in the program. */
  125.  
  126. /*
  127. ** DATA CONFIGURATION SECTION: These settings describe particulars of
  128. ** your own location and where the program looks for certain info. It is
  129. ** recommended that these values be changed appropriately, although the
  130. ** program will still run if they are left alone.
  131. */
  132.  
  133. #ifndef PC
  134. #define DEFAULT_DIR "~/astrolog"
  135. #else
  136. #define DEFAULT_DIR "C:\\ASTROLOG"
  137. #endif
  138.   /* Change this string to directory path program should look in for the  */
  139.   /* astrolog.dat default file, if one is not in the current directory or */
  140.   /* in the dirs indicated by environment variables. For PC systems, use  */
  141.   /* two backslashes instead of one forward one to divide subdirectories. */
  142.  
  143. #define CHART_DIR DEFAULT_DIR
  144.   /* This string is the directory the program looks in for chart info    */
  145.   /* files (-i switch) if not in the current directory. This is normally */
  146.   /* the default dir above but may be changed to be somewhere else.      */
  147.  
  148. #define EPHE_DIR DEFAULT_DIR
  149.   /* This string is the directory the program looks in for the ephemeris */
  150.   /* files as accessed with the -b switch. This is normally the default  */
  151.   /* dir above but may be changed to be somewhere else.                  */
  152.  
  153. #define DEFAULT_LONG 122.20 /* Change these values to the longitude west    */
  154. #define DEFAULT_LAT   47.36 /* and latitude north of your current location. */
  155.                             /* Use negative values for east/southern areas. */
  156.  
  157. #define DEFAULT_ZONE 8.00 /* Change this number to the time zone of your */
  158.                           /* current location in hours before (west of)  */
  159.                           /* GMT. Use negative values for eastern zones. */
  160.  
  161. /*
  162. ** OPTIONAL CONFIGURATION SECTION: Although not necessary, one may like
  163. ** to change some of the values below: These constants affect some of
  164. ** the default parameters and other such things.
  165. */
  166.  
  167. #define DEFAULT_SYSTEM 0 /* Normally, Placidus houses are used (unless the */
  168.                          /* user specifies otherwise). If you want a       */
  169.                          /* different default system, change this number   */
  170.                          /* to a value from 0..9 (values same as in -c).   */
  171.  
  172. #define DEFAULT_ASPECTS 5 /* Default number of aspects to use in charts. */
  173.  
  174. #define DIVISIONS 12 /* Greater numbers means more accuracy but slower  */
  175.                      /* calculation, of exact aspect and transit times. */
  176.  
  177. #define DEFAULT_INFOFILE "astrolog.dat"
  178.   /* Name of file to look in for default program parameters (which will */
  179.   /* override the compile time values here, if the file exists).        */
  180.  
  181. #define ENVIRONALL "ASTROLOG"
  182. #define ENVIRONVER "ASTR"
  183.   /* Name of environment variables to look in for chart, ephemeris, and  */
  184.   /* default files. The second name is a version specific variable which */
  185.   /* gets the current version appended to it before it is accessed.      */
  186.  
  187. #define WHEELCOLS 15   /* Affects width of each house in wheel display.    */
  188. #define WHEELROWS 11   /* Max no. of objects that can be in a wheel house. */
  189. #define SCREENWIDTH 80 /* Number of columns to print interpretations in.   */
  190. #define MONTHSPACE 3   /* Number of spaces between each calendar column.   */
  191. #define MAXINDAY 150   /* Max number of aspects or transits displayable.   */
  192. #define MAXCROSS 750   /* Max number of latitude crossings displayable.    */
  193. #define CREDITWIDTH 74 /* Number of text columns in the -Hc credit screen. */
  194. #define MAXSWITCHES 32 /* Max number of switch parameters per input line.  */
  195. #define PSGUTTER 9     /* Points of white space on PostScript page edge.   */
  196.  
  197.  
  198. #ifdef GRAPH           /* For graphics, this char affects how bitmaps are */
  199. #ifndef PC             /* written. 'N' is written like with the 'bitmap'  */
  200. #define BITMAPMODE 'C' /* program, 'C' is compacted somewhat (files have  */
  201. #else                  /* less spaces), and 'V' is compacted even more.   */
  202. #define BITMAPMODE 'B' /* 'A' means write as rectangular Ascii text file. */
  203. #endif                 /* 'B' means write as Windows bitmap (.bmp) file.  */
  204.  
  205. #ifdef MSG
  206. #define DEFHIRESMODE _MAXRESMODE /* 'High-resolution' PC graphics mode. */
  207. #define DEFLORESMODE _ERESCOLOR  /* 'Flicker-free' PC graphics mode.    */
  208. #endif
  209. #ifdef BGI
  210. #define DEFHIRESMODE 0 /* Zero or less means a 'hi-res' mode of driver. */
  211. #define DEFLORESMODE 1 /* One or more means a 'lo-res' mode of driver.  */
  212. #endif
  213. #endif /* GRAPH */
  214.  
  215. /*#define TRUENODE /* Comment out this #define if you'd prefer the 'Node'    */
  216.                  /* object to refer to the Mean North Node of the Moon by  */
  217.                  /* default as opposed to the True North Node of the Moon. */
  218.  
  219. /*
  220. ** By the time you reach here and the above values are customized as
  221. ** desired, Astrolog is ready to be compiled! Be sure to similarly
  222. ** change the values in the astrolog.dat file, which will override any
  223. ** corresponding compile time values here. Don't change any of the
  224. ** values in the section below unless you know what you're doing.
  225. */
  226.  
  227. #ifdef GRAPH
  228. #define BITMAPX    2730 /* Maximum window size allowed */
  229. #define BITMAPY    2730
  230. #define BITMAPX1    180 /* Minimum window size allowed */
  231. #define BITMAPY1    180
  232. #define DEFAULTX    480 /* Default window size */
  233. #define DEFAULTY    480
  234. #define SIDESIZE    160 /* Size of wheel chart information sidebar.    */
  235. #define MAXMETA 200000L /* Max bytes allowed in a metafile.            */
  236. #define METAMUL      12 /* Metafile coordinate to chart pixel ratio.   */
  237. #define PSMUL        11 /* PostScript coordinate to chart pixel ratio. */
  238. #define CELLSIZE     14 /* Size for each cell in the aspect grid.      */
  239. #define BIODAYS      14 /* Days to include in graphic biorhythms.      */
  240. #define DEGINC        2 /* Number of degrees per segment for circles.  */
  241. #define DEFORB      7.0 /* Min distance glyphs can be from each other. */
  242. #define MAXSCALE    400 /* Max scale factor as passed to -Xs swtich.   */
  243. #define TILTSTEP  11.25 /* Degrees to change when pressing '[' or ']'. */
  244. #endif /* GRAPH */
  245.  
  246. #define chH    (char)(us.fAnsiChar ? 196 : '-')    /* Ansi and Ascii       */
  247. #define chV    (char)(us.fAnsiChar ? 179 : '|')    /* characters used to   */
  248. #define chC    (char)(us.fAnsiChar ? 197 : '|')    /* display text charts. */
  249. #define chNW   (char)(us.fAnsiChar ? 218 : '+')
  250. #define chNE   (char)(us.fAnsiChar ? 191 : '+')
  251. #define chSW   (char)(us.fAnsiChar ? 192 : '+')
  252. #define chSE   (char)(us.fAnsiChar ? 217 : '+')
  253. #define chJN   (char)(us.fAnsiChar ? 193 : '-')
  254. #define chJS   (char)(us.fAnsiChar ? 194 : '-')
  255. #define chJW   (char)(us.fAnsiChar ? 180 : '|')
  256. #define chJE   (char)(us.fAnsiChar ? 195 : '|')
  257. #define chDeg0 (char)(us.fAnsiChar ? 248 : ' ')
  258. #define chDeg1 (char)(us.fAnsiChar ? 248 : ':')
  259.  
  260.  
  261. /*
  262. ** One shouldn't ever need to change anything below this line to compile.
  263. */
  264.  
  265. #define ASTROLOG
  266. #define MATRIX
  267. /*#define BETA /* Uncomment to compile in beta message on startup. */
  268. #include <stdio.h>
  269. #ifndef ATOF
  270. #include <stdlib.h>
  271. #endif
  272. #include <math.h>
  273. #ifdef PC
  274. #include <malloc.h>
  275. #endif
  276. #ifdef TIME
  277. #include <time.h>
  278. #endif
  279.  
  280. #ifdef X11
  281. #define ISG
  282. #include <X11/Xlib.h>
  283. #include <X11/Xutil.h>
  284. #endif
  285. #ifdef WIN
  286. #define ISG
  287. #include "windows.h"
  288. #include "commdlg.h"
  289. #include "print.h"
  290. #include "resource.h"
  291. #endif
  292. #ifdef MSG
  293. #define ISG
  294. #define PCG
  295. #include <graph.h>
  296. #include <conio.h>
  297. #endif
  298. #ifdef BGI
  299. #define ISG
  300. #define PCG
  301. #include <graphics.h>
  302. #include <conio.h>
  303. #endif
  304. #ifdef MACG
  305. #define ISG
  306. #endif
  307.  
  308. #ifdef PS
  309. #define STROKE
  310. #endif
  311. #ifdef META
  312. #define STROKE
  313. #endif
  314. #ifdef MOUSE
  315. #ifdef PC
  316. #include <dos.h>
  317. #endif
  318. #endif /* MOUSE */
  319.  
  320.  
  321. /*
  322. ** Make sure only legal combinations of the graphics options are active.
  323. */
  324.  
  325. #ifdef MAC
  326. #ifdef SWITCHES
  327. "If 'MAC' is defined 'SWITCHES' must not be as well"
  328. #endif
  329. #ifdef ENVIRON
  330. "If 'MAC' is defined 'ENVIRON' must not be as well"
  331. #endif
  332. #endif /* MAC */
  333.  
  334. #ifdef X11
  335. #ifndef GRAPH
  336. "If 'X11' is defined 'GRAPH' must be too"
  337. #endif
  338. #ifdef WIN
  339. "If 'X11' is defined 'WIN' must not be as well"
  340. #endif
  341. #ifdef MSG
  342. "If 'X11' is defined 'MSG' must not be as well"
  343. #endif
  344. #ifdef BGI
  345. "If 'X11' is defined 'BGI' must not be as well"
  346. #endif
  347. #ifdef MACG
  348. "If 'X11' is defined 'MACG' must not be as well"
  349. #endif
  350. #ifdef PC
  351. "If 'X11' is defined 'PC' must not be as well"
  352. #endif
  353. #endif /* X11 */
  354.  
  355. #ifdef WIN
  356. #ifndef GRAPH
  357. "If 'WIN' is defined 'GRAPH' must be too"
  358. #endif
  359. #ifdef X11
  360. "If 'WIN' is defined 'X11' must not be as well"
  361. #endif
  362. #ifdef MSG
  363. "If 'WIN' is defined 'MSG' must not be as well"
  364. #endif
  365. #ifdef BGI
  366. "If 'WIN' is defined 'BGI' must not be as well"
  367. #endif
  368. #ifdef MACG
  369. "If 'WIN' is defined 'MACG' must not be as well"
  370. #endif
  371. #ifndef PC
  372. "If 'WIN' is defined 'PC' must be too"
  373. #endif
  374. #endif /* WIN */
  375.  
  376. #ifdef MSG
  377. #ifndef GRAPH
  378. "If 'MSG' is defined 'GRAPH' must be too"
  379. #endif
  380. #ifdef X11
  381. "If 'MSG' is defined 'X11' must not be as well"
  382. #endif
  383. #ifdef WIN
  384. "If 'MSG' is defined 'WIN' must not be as well"
  385. #endif
  386. #ifdef BGI
  387. "If 'MSG' is defined 'BGI' must not be as well"
  388. #endif
  389. #ifdef MACG
  390. "If 'MSG' is defined 'MACG' must not be as well"
  391. #endif
  392. #ifndef PC
  393. "If 'MSG' is defined 'PC' must be too"
  394. #endif
  395. #endif /* MSG */
  396.  
  397. #ifdef BGI
  398. #ifndef GRAPH
  399. "If 'BGI' is defined 'GRAPH' must be too"
  400. #endif
  401. #ifdef X11
  402. "If 'BGI' is defined 'X11' must not be as well"
  403. #endif
  404. #ifdef WIN
  405. "If 'BGI' is defined 'WIN' must not be as well"
  406. #endif
  407. #ifdef MSG
  408. "If 'BGI' is defined 'MSG' must not be as well"
  409. #endif
  410. #ifdef MACG
  411. "If 'BGI' is defined 'MACG' must not be as well"
  412. #endif
  413. #ifndef PC
  414. "If 'BGI' is defined 'PC' must be too"
  415. #endif
  416. #endif /* BGI */
  417.  
  418. #ifdef MACG
  419. #ifndef GRAPH
  420. "If 'MACG' is defined 'GRAPH' must be too"
  421. #endif
  422. #ifndef MAC
  423. "If 'MACG' is defined 'MAC' must be too"
  424. #endif
  425. #ifdef X11
  426. "If 'MACG' is defined 'X11' must not be as well"
  427. #endif
  428. #ifdef WIN
  429. "If 'MACG' is defined 'WIN' must not be as well"
  430. #endif
  431. #ifdef MSG
  432. "If 'MACG' is defined 'MSG' must not be as well"
  433. #endif
  434. #ifdef BGI
  435. "If 'MACG' is defined 'BGI' must not be as well"
  436. #endif
  437. #ifdef PC
  438. "If 'MACG' is defined 'PC' must not be as well"
  439. #endif
  440. #endif /* MACG */
  441.  
  442. #ifdef MOUSE
  443. #ifdef GRAPH
  444. #ifndef ISG
  445. "If 'MOUSE' is defined 'X11', 'WIN', 'MSG', 'BGI', or 'MACG' must be too"
  446. #endif
  447. #endif /* GRAPH */
  448. #endif /* MOUSE */
  449.  
  450. #ifdef PS
  451. #ifndef GRAPH
  452. "If 'PS' is defined 'GRAPH' must be too"
  453. #endif
  454. #endif /* PS */
  455.  
  456. #ifdef META
  457. #ifndef GRAPH
  458. "If 'META' is defined 'GRAPH' must be too"
  459. #endif
  460. #endif /* META */
  461.  
  462.  
  463. /*
  464. ******************************************************************************
  465. ** Program Constants.
  466. ******************************************************************************
  467. */
  468.  
  469. #ifndef FALSE
  470. #define FALSE 0
  471. #endif
  472. #ifndef TRUE
  473. #define TRUE  1
  474. #endif
  475. #define fFalse FALSE
  476. #define fTrue  TRUE
  477.  
  478. #define szAppNameCore "Astrolog"
  479. #define szVersionCore "5.30"
  480. #define szDateCore    "September 1996"
  481. #define szAddressCore \
  482.   "Astara@msn.com - http://www.magitech.com/~cruiser1/astrolog.htm"
  483. #define szNowCore     "now"
  484. #define szTtyCore     "tty"
  485. #define szSetCore     "set"
  486. #define szNulCore     "nul"
  487.  
  488. #define cchSzDef   80
  489. #define cchSzMax   255
  490. #define nDegMax    360
  491. #define nDegHalf   180
  492. #define yeaJ2G     1582
  493. #define monJ2G     mOct
  494. #define dayJ2G1    4
  495. #define dayJ2G2    15
  496.  
  497. #define rPi        3.14159265358979323846
  498. #define rPi2       (rPi*2.0)
  499. #define rPiHalf    (rPi/2.0)
  500. #define rDegMax    360.0
  501. #define rDegHalf   180.0
  502. #define rDegQuad   90.0
  503. #define rDegRad    (rDegHalf/rPi)
  504. #define rEpoch2000 (-24.736467)
  505. #define rAxis      23.44578889
  506. #define rSmall     (1.7453E-09)
  507. #define rLarge     10000.0
  508. #define rRound     0.5
  509.  
  510. #define chNull     '\0'
  511. #define chEscape   '\33'
  512. #define chBell     '\7'
  513. #define chReturn   '\r'
  514. #define chTab      '\t'
  515. #define chDelete   '\b'
  516. #define chBreak    '\3'
  517. #define chRet      'R'
  518.  
  519. /* Array index limits */
  520.  
  521. #define cSign      12
  522. #define cObj       87
  523. #define cObjInt    uranHi
  524. #define objMax     (cObj+1)
  525. #define cAspect    18
  526. #define cAspectInt 11
  527. #define cSystem    14
  528. #define cCnstl     88
  529. #define cZone      69
  530. #define cSector    36
  531. #define cPart      177
  532. #define cAspConfig 6
  533. #define cWeek      7
  534. #define cColor     16
  535. #define xFont      6
  536. #define yFont      10
  537. #define xFontT     (xFont*gi.nScaleT)
  538. #define yFontT     (yFont*gi.nScaleT)
  539. #define xSideT     (SIDESIZE*gi.nScaleT)
  540.  
  541. /* Object array index values */
  542.  
  543. #define cPlanet oVes
  544. #define cThing  oLil
  545. #define oMain   10
  546. #define oCore   20
  547. #define cUran   8
  548. #define cStar   47
  549. #define cuspLo  21
  550. #define cuspHi  32
  551. #define uranLo  33
  552. #define uranHi  40
  553. #define oNorm   uranHi
  554. #define starLo  41
  555. #define starHi  cObj
  556.  
  557. /* Month index values */
  558.  
  559. #define mJan 1
  560. #define mFeb 2
  561. #define mMar 3
  562. #define mApr 4
  563. #define mMay 5
  564. #define mJun 6
  565. #define mJul 7
  566. #define mAug 8
  567. #define mSep 9
  568. #define mOct 10
  569. #define mNov 11
  570. #define mDec 12
  571.  
  572. /* Elements */
  573.  
  574. #define eFir 0
  575. #define eEar 1
  576. #define eAir 2
  577. #define eWat 3
  578.  
  579. /* Zodiac signs */
  580.  
  581. #define sAri 1
  582. #define sTau 2
  583. #define sGem 3
  584. #define sCan 4
  585. #define sLeo 5
  586. #define sVir 6
  587. #define sLib 7
  588. #define sSco 8
  589. #define sSag 9
  590. #define sCap 10
  591. #define sAqu 11
  592. #define sPis 12
  593.  
  594. /* Objects */
  595.  
  596. #define oEar 0
  597. #define oSun 1
  598. #define oMoo 2
  599. #define oMer 3
  600. #define oVen 4
  601. #define oMar 5
  602. #define oJup 6
  603. #define oSat 7
  604. #define oUra 8
  605. #define oNep 9
  606. #define oPlu 10
  607. #define oChi 11
  608. #define oCer 12
  609. #define oVes 15
  610. #define oNod 16
  611. #define oLil 17
  612. #define oSou 17
  613. #define oFor 18
  614. #define oVtx 19
  615. #define oEP  20
  616. #define oAsc 21
  617. #define oNad 24
  618. #define oDes 27
  619. #define oMC  30
  620. #define oOri (starLo-1+10)
  621. #define oAnd (starLo-1+47)
  622.  
  623. /* Aspects */
  624.  
  625. #define aDir -2
  626. #define aSig -1
  627. #define aCon 1
  628. #define aOpp 2
  629. #define aSqu 3
  630. #define aTri 4
  631. #define aSex 5
  632. #define aInc 6
  633. #define aSSx 7
  634. #define aSSq 8
  635. #define aSes 9
  636. #define aQui 10
  637. #define aBQn 11
  638.  
  639. /* Biorhythm cycle constants */
  640.  
  641. #define brPhy 23.0
  642. #define brEmo 28.0
  643. #define brInt 33.0
  644.  
  645. /* Relationship chart modes */
  646.  
  647. #define rcSynastry   1
  648. #define rcComposite  2
  649. #define rcMidpoint   3
  650. #define rcDifference 4
  651. #define rcBiorhythm  5
  652. #define rcDual      -1
  653. #define rcTriWheel  -2
  654. #define rcQuadWheel -3
  655. #define rcTransit   -4
  656. #define rcProgress  -5
  657.  
  658. /* Aspect configurations */
  659.  
  660. #define acS  1
  661. #define acGT 2
  662. #define acTS 3
  663. #define acY  4
  664. #define acGC 5
  665. #define acC  6
  666.  
  667. /* Graphics chart modes */
  668.  
  669. #define gWheel      1
  670. #define gHouse      2
  671. #define gGrid       3
  672. #define gHorizon    4
  673. #define gOrbit      5
  674. #define gSector     6
  675. #define gCalendar   7
  676. #define gDisposit   8
  677. #define gAstroGraph 9
  678. #define gEphemeris 10
  679. #define gWorldMap  11
  680. #define gGlobe     12
  681. #define gPolar     13
  682. #define gBiorhythm 14
  683. #ifdef WIN
  684. #define gAspect    15
  685. #define gMidpoint  16
  686. #define gArabic    17
  687. #define gSign      18
  688. #define gObject    19
  689. #define gHelpAsp   20
  690. #define gConstel   21
  691. #define gPlanet    22
  692. #define gMeaning   23
  693. #define gSwitch    24
  694. #define gObscure   25
  695. #define gKeystroke 26
  696. #define gCredit    27
  697. #define gRising    28
  698. #define gTraTraHit 29
  699. #define gTraTraInf 30
  700. #define gTraNatHit 31
  701. #define gTraNatInf 32
  702. #endif
  703.  
  704. /* Colors */
  705.  
  706. #define kReverse -2
  707. #define kDefault -1
  708. #define kBlack   0
  709. #define kMaroon  1
  710. #define kDkGreen 2
  711. #define kOrange  3
  712. #define kDkBlue  4
  713. #define kPurple  5
  714. #define kDkCyan  6
  715. #define kLtGray  7
  716. #define kDkGray  8
  717. #define kRed     9
  718. #define kGreen   10
  719. #define kYellow  11
  720. #define kBlue    12
  721. #define kMagenta 13
  722. #define kCyan    14
  723. #define kWhite   15
  724. #define kNull    16
  725.  
  726. /* Arabic parts */
  727.  
  728. #define apFor 0
  729. #define apSpi 1
  730.  
  731. /* Draw text formatting flags */
  732.  
  733. #define dtCent   0x0
  734. #define dtLeft   0x1
  735. #define dtBottom 0x2
  736. #define dtErase  0x4
  737. #define dtScale  0x8
  738. #define dtTop    0x10
  739.  
  740. /* User string parse modes */
  741.  
  742. #define pmMon     1
  743. #define pmDay     2
  744. #define pmYea     3
  745. #define pmTim     4
  746. #define pmDst     5
  747. #define pmZon     6
  748. #define pmLon     7
  749. #define pmLat     8
  750. #define pmObject  9
  751. #define pmAspect 10
  752. #define pmSystem 11
  753. #define pmSign   12
  754. #define pmColor  13
  755.  
  756. /* PC mouse flags */
  757.  
  758. #define mfLeft   0x01
  759. #define mfRight  0x02
  760. #define mfMiddle 0x04
  761.  
  762. /* Termination codes */
  763.  
  764. #define tcError -1
  765. #define tcOK    0
  766. #define tcFatal 1
  767. #define tcForce 2
  768.  
  769. #ifndef _ZRES256COLOR
  770. #define _ZRES256COLOR 263
  771. #endif
  772.  
  773.  
  774. /*
  775. ******************************************************************************
  776. ** Macro Functions.
  777. ******************************************************************************
  778. */
  779.  
  780. #define BLo(w) ((byte)(w))
  781. #define BHi(w) ((byte)((word)(w) >> 8 & 0xFF))
  782. #define WLo(l) ((word)(dword)(l))
  783. #define WHi(l) ((word)((dword)(l) >> 16 & 0xFFFF))
  784. #define WFromBB(bLo, bHi) ((word)BLo(bLo) | (word)((byte)(bHi)) << 8)
  785. #define LFromWW(wLo, wHi) ((dword)WLo(wLo) | (dword)((word)(wHi)) << 16)
  786. #define LFromBB(b1, b2, b3, b4) LFromWW(WFromBB(b1, b2), WFromBB(b3, b4))
  787. #ifndef WIN
  788. #define RGB(bR, bG, bB) \
  789.   ((dword)((byte)(bR) | (word)(bG)<<8 | (dword)(byte)(bB)<<16))
  790. #endif
  791. #define RGBR(l) BLo(l)
  792. #define RGBG(l) BHi(l)
  793. #define RGBB(l) ((byte)((dword)(l) >> 16 & 0xFF))
  794. #define ChHex(n) (char)((n) < 10 ? '0' + (n) : 'a' + (n) - 10)
  795. #define VgaFromEga(x) NMultDiv((x), 480, 350)
  796. #define VgaFromCga(x) NMultDiv((x), 480, 200)
  797.  
  798. #define Max(v1, v2) ((v1) > (v2) ? (v1) : (v2))
  799. #define Min(v1, v2) ((v1) < (v2) ? (v1) : (v2))
  800. #define NSgn(n) ((n) < 0 ? -1 : (n) > 0)
  801. #define RSgn2(r) ((r) < 0.0 ? -1.0 : 1.0)
  802. #define FBetween(v, v1, v2) ((v) >= (v1) && (v) <= (v2))
  803. #define RFract(r) ((r) - RFloor(r))
  804. #define ChCap(ch) ((ch) >= 'a' && (ch) <= 'z' ? (ch) - 'a' + 'A' : (ch))
  805. #define ChUncap(ch) (FCapCh(ch) ? (ch) - 'A' + 'a' : (ch))
  806. #define FCapCh(ch) ((ch) >= 'A' && (ch) <= 'Z')
  807. #define FNumCh(ch) ((ch) >= '0' && (ch) <= '9')
  808. #define NMultDiv(n1, n2, n3) ((int)((long)(n1) * (n2) / (n3)))
  809. #define Ratio(v1, v2, v3) ((v1) + ((v2) - (v1)) * (v3))
  810. #define ZFromS(s) ((real)(((s)-1)*30))
  811. #define SFromZ(r) (((int)(r))/30+1)
  812. #define RFromD(r) ((r)/rDegRad)
  813. #define DFromR(r) ((r)*rDegRad)
  814. #define RAbs(r) fabs(r)
  815. #define RFloor(r) floor(r)
  816. #define NFloor(r) ((int)RFloor(r))
  817. #define RSqr(r) sqrt(r)
  818. #define RSin(r) sin(r)
  819. #define RCos(r) cos(r)
  820. #ifndef PC
  821. #define RTan(r) tan(r)
  822. #else
  823. /* The tangent function in some PC compilers returns a result the negative */
  824. /* of what it should be when doing emulation for a non-math chip machine.  */
  825. #define RTan(r) (sin(r)/cos(r))
  826. #endif
  827. #define RAtn(r) atan(r)
  828. #define RAsin(r) asin(r)
  829. #define RAcos(r) acos(r)
  830. #define RSinD(r) RSin(RFromD(r))
  831. #define RCosD(r) RCos(RFromD(r))
  832. #define NSinD(nR, nD) ((int)((real)(nR)*RSinD((real)nD)))
  833. #define NCosD(nR, nD) ((int)((real)(nR)*RCosD((real)nD)))
  834.  
  835. #define FItem(obj)    FBetween(obj, 0, cObj)
  836. #define FNorm(obj)    FBetween(obj, 0, oNorm)
  837. #define FCusp(obj)    FBetween(obj, cuspLo, cuspHi)
  838. #define FAngle(obj)   (FCusp(obj) && (obj)%3 == 0)
  839. #define FMinor(obj)   (FCusp(obj) && (obj)%3 != 0)
  840. #define FUranian(obj) FBetween(obj, uranLo, uranHi)
  841. #define FStar(obj)    FBetween(obj, starLo, starHi)
  842. #define FObject(obj)  ((obj) <= oVes || (obj) >= uranLo)
  843. #define FThing(obj)   ((obj) <= cThing || (obj) >= uranLo)
  844. #define FHelio(obj)   (FNorm(obj) && FObject(obj) && (obj) != oMoo)
  845. #define FAspect(asp)  FBetween(asp, 1, us.nAsp)
  846. #define FSector(s)    FBetween(s, 1, cSector)
  847. #define ChDst(dst)    (dst == 0.0 ? 'S' : (dst == 1.0 ? 'D' : 'A'))
  848. #define ChDashF(f)    (f ? '=' : '_')
  849. #define SzNumF(f)     (f ? "1 " : "0 ")
  850. #define DayInYearHi(yea) (365-28+DayInMonth(2, yea))
  851. #define FChSwitch(ch) \
  852.   ((ch) == '-' || (ch) == '/' || (ch) == '_' || (ch) == '=' || (ch) == ':')
  853.  
  854. #define FValidMon(mon) FBetween(mon, 1, 12)
  855. #define FValidDay(day, mon, yea) ((day) >= 1 && (day) <= DayInMonth(mon, yea))
  856. #define FValidYea(yea) FBetween(yea, -20000, 20000)
  857. #define FValidTim(tim) ((tim) > -2.0 && (tim) < 24.0 && \
  858.   RFract(RAbs(tim)) < 0.60)
  859. #define FValidDst(dst) FValidZon(dst)
  860. #define FValidZon(zon) FBetween(zon, -24.0, 24.0)
  861. #define FValidLon(lon) FBetween(lon, -rDegHalf, rDegHalf)
  862. #define FValidLat(lat) FBetween(lat, -rDegQuad, rDegQuad)
  863. #define FValidAspect(asp) FBetween(asp, 0, cAspect)
  864. #define FValidSystem(n) FBetween(n, 0, cSystem-1)
  865. #define FValidDivision(n) FBetween(n, 1, 2880)
  866. #define FValidOffset(r) FBetween(r, -rDegMax, rDegMax)
  867. #define FValidCenter(obj) \
  868.   (FBetween(obj, oEar, uranHi) && FObject(obj) && (obj) != oMoo)
  869. #define FValidHarmonic(n) FBetween(n, 1, 30000)
  870. #define FValidWheel(n) FBetween(n, 1, WHEELROWS)
  871. #define FValidAstrograph(n) (n > 0 && 160%n == 0)
  872. #define FValidPart(n) FBetween(n, 1, cPart)
  873. #define FValidBioday(n) FBetween(n, 1, 199)
  874. #define FValidScreen(n) FBetween(n, 20, 200)
  875. #define FValidMacro(n) FBetween(n, 1, 48)
  876. #define FValidTextrows(n) ((n) == 25 || (n) == 43 || (n) == 50)
  877. #define FValidGlyphs(n) FBetween(n, 0, 2223)
  878. #define FValidGrid(n) FBetween(n, 1, cObj)
  879. #define FValidScale(n) (FBetween(n, 100, MAXSCALE) && (n)%100 == 0)
  880. #define FValidGraphx(x) (FBetween(x, BITMAPX1, BITMAPX) || (x) == 0)
  881. #define FValidGraphy(y) (FBetween(y, BITMAPY1, BITMAPY) || (y) == 0)
  882. #define FValidRotation(n) FBetween(n, 0, nDegMax-1)
  883. #define FValidTilt(n) FBetween(n, -rDegQuad, rDegQuad)
  884. #define FValidColor(n) FBetween(n, 0, cColor - 1)
  885. #define FValidBmpmode(ch) \
  886.   ((ch) == 'N' || (ch) == 'C' || (ch) == 'V' || (ch) == 'A' || (ch) == 'B')
  887. #define FValidTimer(n) FBetween(n, 1, 32000)
  888.  
  889. #define chSig3(A) szSignName[A][0], szSignName[A][1], szSignName[A][2]
  890. #define chObj3(A) szObjName[A][0], szObjName[A][1], szObjName[A][2]
  891. #define chMon3(A) szMonth[A][0], szMonth[A][1], szMonth[A][2]
  892. #define chDay3(A) szDay[A][0], szDay[A][1], szDay[A][2]
  893. #define kSignA(s) kElemA[(s)-1 & 3]
  894. #define kSignB(s) kElemB[(s)-1 & 3]
  895. #define kModeA(m) kElemA[m <= 1 ? m : eWat]
  896. #define szPerson  (ciMain.nam[0] ? ciMain.nam : "This person")
  897. #define szPerson0 (ciMain.nam[0] ? ciMain.nam : "the person")
  898. #define szPerson1 (ciMain.nam[0] ? ciMain.nam : "Person1")
  899. #define szPerson2 (ciTwin.nam[0] ? ciTwin.nam : "Person2")
  900. #define FIgnore(i) (ignore[i] || (i) == us.objCenter)
  901. #define FIgnore2(i) (ignore2[i] || (i) == us.objCenter)
  902. #define fSouthNode (!us.fPlacalc)
  903. #define fNoTimeOrSpace (Mon == -1)
  904.  
  905. #define loop for (;;)
  906. #define not(V) V = !(V)
  907. #define neg(V) V = -(V)
  908. #define PrintL() PrintCh('\n')
  909. #define PrintL2() PrintSz("\n\n")
  910. #define PrintF(sz) fprintf(file, sz)
  911. #define PrintFSz() fprintf(file, sz)
  912. #define SwapN(n1, n2) (n1)^=(n2)^=(n1)^=(n2)
  913. #define FSwitchF(f) ((((f) | fOr) & !fAnd) ^ fNot)
  914. #define SwitchF(f) f = FSwitchF(f)
  915. #define SwitchF2(f) f = (((f) | (fOr || fNot)) & !fAnd)
  916. #define SetCI(ci, M, D, Y, T, S, Z, O, A) \
  917.   ci.mon = M; ci.day = D; ci.yea = Y; \
  918.   ci.tim = T; ci.dst = S; ci.zon = Z; ci.lon = O; ci.lat = A
  919.  
  920. #ifndef PC
  921. #define chDirSep '/'
  922. #define chSwitch '-'
  923. #define CONST
  924. #define NPTR
  925. #define FPTR
  926. #define HPTR
  927. #define AllocateNear(p, cb) (p) = (void *)malloc(cb)
  928. #define AllocateFar(p, cb)  AllocateNear(p, cb)
  929. #define AllocateHuge(p, cb) AllocateFar(p, cb)
  930. #define DeallocateNear(p) free(p)
  931. #define DeallocateFar(p)  DeallocateNear(p)
  932. #define DeallocateHuge(p) DeallocateFar(p)
  933. #ifndef MAC
  934. #define ldTime 2440588L
  935. #else
  936. #define ldTime 2416481L
  937. #endif
  938. #define ARR
  939. #else /* PC */
  940. #define chDirSep '\\'
  941. #define chSwitch '/'
  942. #define CONST const
  943. #define EXPORT _export
  944. #ifndef WIN
  945. #define NPTR near
  946. #define FPTR far
  947. #else
  948. #define NPTR
  949. #define FPTR
  950. #endif
  951. #define HPTR huge
  952. #define AllocateNear(p, cb) (p) = malloc(cb)
  953. #define AllocateFar(p, cb)  (p) = _fmalloc(cb)
  954. #define AllocateHuge(p, cb) (p) = halloc(cb, sizeof(byte))
  955. #define DeallocateNear(p) free(p)
  956. #define DeallocateFar(p)  _ffree(p)
  957. #define DeallocateHuge(p) hfree(p)
  958. #define ldTime 2440588L
  959. #ifndef __TURBOC__
  960. #define ARR
  961. #else
  962. #define ARR far
  963. #endif
  964. #endif /* PC */
  965.  
  966. #ifdef GRAPH
  967. #ifdef WIN
  968. #define API FAR PASCAL
  969. #define hdcNil ((HDC)NULL)
  970. #endif
  971. #ifdef MSG
  972. #define xPcScreen gi.cfg.numxpixels
  973. #define yPcScreen gi.cfg.numypixels
  974. #define FValidResmode(n) FBetween(n, _MAXRESMODE, _ZRES256COLOR)
  975. #define FEgaRes(res) (res == _ERESNOCOLOR || res == _ERESCOLOR)
  976. #define FCgaRes(res) (res == _HRESBW || res == _HRES16COLOR)
  977. #define PcMoveTo(x, y) _moveto(x, y)
  978. #define PcLineTo(x, y) _lineto(x, y)
  979. #define PcSetTextRows(n) _settextrows(gs.nTextRows)
  980. #endif
  981. #ifdef BGI
  982. #define xPcScreen (getmaxx()+1)
  983. #define yPcScreen (getmaxy()+1)
  984. #define FValidResmode(n) FBetween(n, -500, 500)
  985. #define FEgaRes(res) (yPcScreen == 350)
  986. #define FCgaRes(res) (yPcScreen == 200)
  987. #define PcMoveTo(x, y) moveto(x, y)
  988. #define PcLineTo(x, y) lineto(x, y)
  989. #define PcSetTextRows(n) if ((n) > 25) textmode(C4350)
  990. #endif
  991.  
  992. /* Should an object in the outer wheel be restricted? */
  993. #define FProper2(i) \
  994.   (!(us.nRel == rcTransit ? ignore2[i] : ignore[i]) && i != us.objCenter)
  995.  
  996. /* Are particular coordinates on the chart? */
  997. #define FInRect(x, y, x1, y1, x2, y2) \
  998.   ((x) >= (x1) && (x) < (x2) && (y) >= (y1) && (y) < (y2))
  999. #define FOnWin(X, Y) FInRect((X), (Y), 0, 0, gs.xWin, gs.yWin)
  1000.  
  1001. /* Get a coordinate based on chart radius, a fraction, and (co)sin value. */
  1002. #define POINT1(U, R, S) ((int)(((U)+1.4)*(R)*(S)))
  1003. #define POINT2(U, R, S) ((int)(((U)-0.3)*(R)*(S)))
  1004.  
  1005. /* Determine (co)sin factors based on zodiac angle and chart orientation. */
  1006. #define PX(A) RCosD(A)
  1007. #define PY(A) RSinD(A)
  1008. #define PZ(A) Mod(rDegHalf-(A)+asc)
  1009.  
  1010. /* Compute Mollewide projection in pixel scale given latitude. */
  1011. #define NMollewide(y) \
  1012.   ((int)(RSqr((real)(180L*nScl*180L*nScl - 4L*(y)*nScl*(y)*nScl))+rRound))
  1013.  
  1014. /* Do settings indicate the current chart should have the info sidebar? */
  1015. #define fSidebar ((gi.nMode == gWheel || gi.nMode == gHouse || \
  1016.   gi.nMode == gSector) && gs.fText && !us.fVelocity)
  1017.  
  1018. /* Is the current chart most properly displayed as a square graphic? */
  1019. #define fSquare \
  1020.   (gi.nMode == gWheel || gi.nMode == gHouse || gi.nMode == gGrid || \
  1021.   (gi.nMode == gHorizon && us.fPrimeVert) || gi.nMode == gDisposit || \
  1022.   gi.nMode == gOrbit || gi.nMode == gGlobe || gi.nMode == gPolar)
  1023.  
  1024. /* Does the current chart have to be displayed in a map rectangle? */
  1025. #define fMap \
  1026.   (gi.nMode == gAstroGraph || gi.nMode == gWorldMap)
  1027.  
  1028. /* Do settings indicate the current chart should have an outer border? */
  1029. #define fDrawBorder \
  1030.   ((gs.fBorder || gi.nMode == gGrid) && gi.nMode != gGlobe && \
  1031.   gi.nMode != gPolar && (gi.nMode != gWorldMap || !gs.fMollewide))
  1032.  
  1033. /* Do settings indicate current chart should have chart info at its bottom? */
  1034. #define fDrawText \
  1035.   (gs.fText && gi.nMode != gCalendar && gi.nMode != gWorldMap && \
  1036.   gi.nMode != gGlobe && gi.nMode != gPolar && ((gi.nMode != gWheel && \
  1037.   gi.nMode != gHouse && gi.nMode != gSector) || us.fVelocity))
  1038. #endif /* GRAPH */
  1039.  
  1040.  
  1041. /*
  1042. ******************************************************************************
  1043. ** Type Definitions.
  1044. ******************************************************************************
  1045. */
  1046.  
  1047. #define byte  unsigned char
  1048. #define word  unsigned short
  1049. #define dword unsigned long
  1050. #define word4 long
  1051. #define real  double
  1052. #define _char unsigned char
  1053. #define _int  unsigned int
  1054. #define bool  int
  1055. #define _bool char
  1056. #define lpbyte byte FPTR *
  1057. #define hpbyte byte HPTR *
  1058. #define lpreal real FPTR *
  1059.  
  1060. typedef struct _GridInfo {
  1061.   byte  n[objMax][objMax];
  1062.   short v[objMax][objMax];
  1063. } GridInfo;
  1064.  
  1065. typedef struct _CrossInfo {
  1066.   real lat[MAXCROSS];
  1067.   real lon[MAXCROSS];
  1068.   int obj1[MAXCROSS];
  1069.   int obj2[MAXCROSS];
  1070. } CrossInfo;
  1071.  
  1072. #ifdef GRAPH
  1073. #define KV unsigned long
  1074. #define KI int
  1075. #endif /* GRAPH */
  1076.  
  1077. typedef struct _UserSettings {
  1078.  
  1079.   /* Chart types */
  1080.   _bool fListing;       /* -v */
  1081.   _bool fWheel;         /* -w */
  1082.   _bool fGrid;          /* -g */
  1083.   _bool fAspList;       /* -a */
  1084.   _bool fMidpoint;      /* -m */
  1085.   _bool fHorizon;       /* -Z */
  1086.   _bool fOrbit;         /* -S */
  1087.   _bool fSector;        /* -l */
  1088.   _bool fInfluence;     /* -j */
  1089.   _bool fAstroGraph;    /* -L */
  1090.   _bool fCalendar;      /* -K */
  1091.   _bool fInDay;         /* -d */
  1092.   _bool fInDayInf;      /* -D */
  1093.   _bool fEphemeris;     /* -E */
  1094.   _bool fTransit;       /* -t */
  1095.   _bool fTransitInf;    /* -T */
  1096.  
  1097.   /* Chart suboptions */
  1098.   _bool fVelocity;      /* -v0 */
  1099.   _bool fWheelReverse;  /* -w0 */
  1100.   _bool fGridConfig;    /* -g0 */
  1101.   _bool fAppSep;        /* -ga */
  1102.   _bool fParallel;      /* -gp */
  1103.   _bool fAspSummary;    /* -a0 */
  1104.   _bool fMidSummary;    /* -m0 */
  1105.   _bool fMidAspect;     /* -ma */
  1106.   _bool fPrimeVert;     /* -Z0 */
  1107.   _bool fHorizonSearch; /* -Zd */
  1108.   _bool fSectorApprox;  /* -l0 */
  1109.   _bool fInfluenceSign; /* -j0 */
  1110.   _bool fLatitudeCross; /* -L0 */
  1111.   _bool fCalendarYear;  /* -Ky */
  1112.   _bool fInDayMonth;    /* -dm */
  1113.   _bool fArabicFlip;    /* -P0 */
  1114.  
  1115.   /* Table chart types */
  1116.   _bool fCredit;        /* -Hc */
  1117.   _bool fSwitch;        /* -H  */
  1118.   _bool fSwitchRare;    /* -Y  */
  1119.   _bool fKeyGraph;      /* -HX */
  1120.   _bool fSign;          /* -HC */
  1121.   _bool fObject;        /* -HO */
  1122.   _bool fAspect;        /* -HA */
  1123.   _bool fConstel;       /* -HF */
  1124.   _bool fOrbitData;     /* -HS */
  1125.   _bool fMeaning;       /* -HI */
  1126.  
  1127.   /* Main flags */
  1128.   _bool fLoop;        /* -Q */
  1129.   _bool fSidereal;    /* -s */
  1130.   _bool fCusp;        /* -C */
  1131.   _bool fUranian;     /* -u */
  1132.   _bool fProgress;    /* Are we doing a -p progressed chart?           */
  1133.   _bool fInterpret;   /* Is -I interpretation switch in effect?        */
  1134.   _bool fFlip;        /* -f */
  1135.   _bool fDecan;       /* -3 */
  1136.   _bool fGeodetic;    /* -G */
  1137.   _bool fPlacalc;     /* -b */
  1138.   _bool fWriteFile;   /* -o */
  1139.   _bool fAnsiColor;   /* -k */
  1140.   _bool fGraphics;    /* -X */
  1141.  
  1142.   /* Main subflags */
  1143.   _bool fNoSwitches;
  1144.   _bool fLoopInit;    /* -Q0 */
  1145.   _bool fSeconds;     /* -b0 */
  1146.   _bool fPlacalcAst;  /* -ba */
  1147.   _bool fEquator;     /* -sr */
  1148.   _bool fSolarArc;    /* -p0 */
  1149.   _bool fWritePos;    /* -o0 */
  1150.   _bool fAnsiChar;    /* -k0 */
  1151.  
  1152.   /* Rare flags */
  1153.   _bool fTrueNode;    /* -Yn */
  1154.   _bool fEuroDate;    /* -Yd */
  1155.   _bool fEuroTime;    /* -Yt */
  1156.   _bool fSmartCusp;   /* -YC */
  1157.   _bool fClip80;      /* -Y8 */
  1158.   _bool fWriteOld;    /* -Yo */
  1159.   _bool fHouseAngle;  /* -Yc */
  1160.   _bool fIgnoreSign;  /* -YR0 */
  1161.   _bool fIgnoreDir;   /* -YR0 */
  1162.   _bool fNoWrite;     /* -0o */
  1163.   _bool fNoRead;      /* -0i */
  1164.   _bool fNoQuit;      /* -0q */
  1165.   _bool fNoGraphics;  /* -0X */
  1166.  
  1167.   /* Value settings */
  1168.   int   nEphemYears;  /* -Ey */
  1169.   int   nArabic;      /* -P */
  1170.   int   nRel;         /* What relationship chart are we doing, if any? */
  1171.   int   nHouseSystem; /* -c */
  1172.   int   nAsp;         /* -A */
  1173.   int   objCenter;    /* -h */
  1174.   int   nStar;        /* -U */
  1175.   int   nHarmonic;    /* Harmonic chart value passed to -x switch.     */
  1176.   int   objOnAsc;     /* House value passed to -1 or -2 switch.        */
  1177.   int   dayDelta;     /* -+, -- */
  1178.   int   nDegForm;     /* -s */
  1179.   int   nDivision;    /* -d */
  1180.   int   nScreenWidth; /* -I */
  1181.   real  dstDef;       /* -z0 */
  1182.   real  zonDef;       /* -z  */
  1183.   real  lonDef;       /* -l  */
  1184.   real  latDef;       /* -l  */
  1185.  
  1186.   /* Value subsettings */
  1187.   int   nWheelRows;      /* Number of rows per house to use for -w wheel. */
  1188.   int   nAstroGraphStep; /* Latitude step rate passed to -L switch.       */
  1189.   int   nArabicParts;    /* Arabic parts to include value passed to -P.   */
  1190.   real  rZodiacOffset;   /* Position shifting value passed to -s switch.  */
  1191.   real  rProgDay;        /* Progression day value passed to -pd switch.   */
  1192.   int   nRatio1;         /* Chart ratio factors passed to -rc or -rm.     */
  1193.   int   nRatio2;
  1194.   int   nScrollRow;      /* -YQ */
  1195.   long  lTimeAddition;   /* -Yz */
  1196.   int   nArabicNight;    /* -YP */
  1197.   int   nBioday;         /* -Yb */
  1198. } US;
  1199.  
  1200. typedef struct _InternalSettings {
  1201.   _bool fHaveInfo;    /* Do we need to prompt user for chart info?         */
  1202.   _bool fProgress;    /* Are we doing a chart involving progression?       */
  1203.   _bool fReturn;      /* Are we doing a transit chart for returns?         */
  1204.   _bool fMult;        /* Have we already printed at least one text chart?  */
  1205.   _bool fSeconds;     /* Do we print locations to nearest second?          */
  1206.   _bool fSzPersist;   /* Are parameter strings persistent when processing? */
  1207.   _bool fSzInteract;  /* Are we in middle of chart so some setting fixed?  */
  1208.   _bool fNoEphFile;   /* Have we already had a ephem file not found error? */
  1209.   char *szProgName;   /* The name and path of the executable running.      */
  1210.   char *szFileScreen; /* The file to send text output to as passed to -os. */
  1211.   char *szFileOut;    /* The output chart filename string as passed to -o. */
  1212.   char **rgszComment; /* Points to any comment strings after -o filename.  */
  1213.   int cszComment;     /* The number of strings after -o that are comments. */
  1214.   int cchCol;         /* The current column text charts are printing at.   */
  1215.   int cchRow;         /* The current row text charts have scrolled to.     */
  1216.   real rSid;          /* Sidereal offset degrees to be added to locations. */
  1217.   real JD;            /* Fractional Julian day for current chart.          */
  1218.   real JDp;           /* Julian day that a progressed chart indicates.     */
  1219.   FILE *S;  /* File to write text to.   */
  1220.   real T;   /* Julian time for chart.   */
  1221.   real MC;  /* Midheaven at chart time. */
  1222.   real Asc; /* Ascendant at chart time. */
  1223.   real RA;  /* Right ascension at time. */
  1224.   real OB;  /* Obliquity of ecliptic.   */
  1225. } IS;
  1226.  
  1227. typedef struct _ChartInfo {
  1228.   int mon;   /* Month            */
  1229.   int day;   /* Day              */
  1230.   int yea;   /* Year             */
  1231.   real tim;  /* Time in hours    */
  1232.   real dst;  /* Daylight offset  */
  1233.   real zon;  /* Time zone        */
  1234.   real lon;  /* Longitude        */
  1235.   real lat;  /* Latitude         */
  1236.   char *nam; /* Name for chart   */
  1237.   char *loc; /* Name of location */
  1238. } CI;
  1239.  
  1240. typedef struct _ChartPositions {
  1241.   real obj[objMax];   /* The zodiac positions.    */
  1242.   real alt[objMax];   /* Ecliptic declination.    */
  1243.   real dir[objMax];   /* Retrogradation velocity. */
  1244.   real cusp[cSign+1]; /* House cusp positions.    */
  1245.   byte house[objMax]; /* House each object is in. */
  1246. } CP;
  1247.  
  1248. #ifdef GRAPH
  1249. typedef struct _GraphicsSettings {
  1250.   _bool fBitmap;    /* Are we creating a bitmap file (-Xb set).         */
  1251.   _bool fPS;        /* Are we generating a PostScript file (-Xp set).   */
  1252.   _bool fMeta;      /* Are we generating a metafile graphic (-XM set).  */
  1253.   _bool fColor;     /* Are we drawing a color chart (-Xm not set).      */
  1254.   _bool fInverse;   /* Are we drawing in reverse video (-Xr set).       */
  1255.   _bool fRoot;      /* Are we drawing on the X11 background (-XB set).  */
  1256.   _bool fText;      /* Are we printing chart info on chart (-XT set).   */
  1257.   _bool fFont;      /* Are we simulating fonts in charts (-XM0 set).    */
  1258.   _bool fAlt;       /* Are we drawing in alternate mode (-Xi set).      */
  1259.   _bool fBorder;    /* Are we drawing borders around charts (-Xu set).  */
  1260.   _bool fLabel;     /* Are we labeling objects in charts (-Xl not set). */
  1261.   _bool fJetTrail;  /* Are we not clearing screen on updates (-Xj set). */
  1262.   _bool fMouse;     /* Are we not considering PC mouse inputs.          */
  1263.   _bool fConstel;   /* Are we drawing maps as constellations (-XF set). */
  1264.   _bool fMollewide; /* Are we drawing maps scaled correctly (-XW0 set). */
  1265.   _bool fPrintMap;  /* Are we printing globe names on draw (-XP0 set).  */
  1266.   int xWin;         /* Current size of graphic chart (-Xw).      */
  1267.   int yWin;
  1268.   int nAnim;        /* Current animation mode, if any (-Xn).     */
  1269.   int nScale;       /* Current character scale factor (-Xs).     */
  1270.   int objLeft;      /* Current object to place on Asc (-X1).     */
  1271.   int nTextRows;    /* Numb. of rows to set text screen to (-V). */
  1272.   int nRot;         /* Current rotation degree of globe.         */
  1273.   real rTilt;       /* Current vertical tilt of rotating globe.  */
  1274.   char chBmpMode;   /* Current bitmap file type (-Xb).           */
  1275.   int nOrient;      /* PostScript paper orientation indicator.   */
  1276.   real xInch;       /* PostScript horizontal paper size inches.  */
  1277.   real yInch;       /* PostScript vertical paper size inches.    */
  1278.   char *szDisplay;  /* Current X11 display name (-Xd).           */
  1279.   int nGridCell;    /* Number of cells in -g grids (-Yg).        */
  1280.   int nGlyphs;      /* Settings for what gylphs to use (-YG).    */
  1281. #ifdef PCG
  1282.   int nResHi;       /* 'High-resolution' graphics mode. */
  1283.   int nResLo;       /* 'Flicker-free' graphics mode.    */
  1284. #endif
  1285. } GS;
  1286.  
  1287. typedef struct _GraphicsInternal {
  1288.   int nMode;            /* Current type of chart to create.           */
  1289.   _bool fMono;          /* Is this a monochrome monitor.              */
  1290.   int kiCur;            /* Current color drawing with.                */
  1291.   hpbyte bm;            /* Pointer to allocated memory.               */
  1292.   int cbBmpRow;         /* Horizontal size of bitmap array in memory. */
  1293.   char *szFileOut;      /* Current name of bitmap file (-Xo).         */
  1294.   FILE *file;           /* Actual file handle writing graphics to.    */
  1295.   int yBand;            /* Vertical offset to current bitmap band.    */
  1296.   _bool fFile;          /* Are we making a graphics file.             */
  1297.   int nScale;           /* Scale ratio, i.e. percentage / 100.        */
  1298.   int nScaleT;          /* Relative scale to draw chart text at.      */
  1299.   int nPenWid;          /* Pen width to use when creating metafiles.  */
  1300.   KI kiOn;              /* Foreground color. */
  1301.   KI kiOff;             /* Background color. */
  1302.   KI kiLite;            /* Hilight color.    */
  1303.   KI kiGray;            /* A "dim" color.    */
  1304.   int xOffset;          /* Viewport origin.                           */
  1305.   int yOffset;
  1306.   int xTurtle;          /* Current coordinates of drawing pen.        */
  1307.   int yTurtle;
  1308.   int xPen;             /* Cached coordinates where last line ended.  */
  1309.   int yPen;
  1310. #ifdef X11
  1311.   Display *disp;        /* The opened X11 display (-Xd). */
  1312.   GC gc, pmgc;
  1313.   Pixmap pmap, icon;
  1314.   Window wind, root;
  1315.   int screen;
  1316.   int depth;            /* Number of active color bits.  */
  1317. #endif
  1318. #ifdef PS               /* Variables used by the PostScript generator. */
  1319.   _bool fEps;           /* Are we doing Encapsulated PostScript.    */
  1320.   int cStroke;          /* Number of items drawn without fluahing.  */
  1321.   _bool fLineCap;       /* Are line ends rounded instead of square. */
  1322.   int nDash;            /* How much long are dashes in lines drawn. */
  1323.   int nFont;            /* What system font are we drawing text in. */
  1324.   real rLineWid;        /* How wide are lines, et al, drawn with.   */
  1325. #endif
  1326. #ifdef META             /* Variables used by the metafile generator.  */
  1327.   word HPTR *pwMetaCur; /* Current mem position when making metafile. */
  1328.   word HPTR *pwPoly;    /* Position for start of current polyline.    */
  1329.   long cbMeta;
  1330.   KI kiLineAct;         /* Desired and actual line color. */
  1331.   KI kiLineDes;
  1332.   KI kiFillAct;         /* Desired and actual fill color. */
  1333.   KI kiFillDes;
  1334.   int nFontAct;         /* Desired and actual text font.  */
  1335.   int nFontDes;
  1336.   KI kiTextAct;         /* Desired and actual text color. */
  1337.   KI kiTextDes;
  1338.   int nAlignAct;        /* Desired/actual text alignment. */
  1339.   int nAlignDes;
  1340. #endif
  1341. #ifdef MSG              /* MS graphics PC specific global variables.  */
  1342.   int nRes;             /* Current graphics mode.                     */
  1343.   struct videoconfig cfg;          /* State of current graphics mode. */
  1344. #endif
  1345. #ifdef BGI              /* Borland BGI PC specific global variables.  */
  1346.   int nRes;             /* Current graphics mode.              */
  1347.   _bool fLoaded;        /* Have we loaded the graphics driver. */
  1348.   int nDriver;          /* Current graphics driver.            */
  1349.   int nGraph;           /* Current mode within driver.         */
  1350.   int nPages;           /* Number of pages in current mode.    */
  1351.   int nPageCur;         /* The current page bring drawn in.    */
  1352. #endif
  1353. #ifdef MACG
  1354.   WindowPtr wpAst;
  1355.   Rect rcDrag;
  1356.   Rect rcBounds;
  1357. #endif
  1358. } GI;
  1359. #endif /* GRAPH */
  1360.  
  1361. typedef struct _ArabicInfo {
  1362.   char *form;                 /* The formula to calculate it. */
  1363.   char *name;                 /* The name of the Arabic part. */
  1364. } AI;
  1365.  
  1366. typedef struct _ElementTable {
  1367.   int coSum;            /* Total objects considered.          */
  1368.   int coHemi;           /* Number that can be in hemispheres. */
  1369.   int coSign[cSign];    /* Number of objects in each sign.    */
  1370.   int coHouse[cSign];   /* Number of objects in each house.   */
  1371.   int coElemMode[4][3]; /* Objects in each elem/mode combo.   */
  1372.   int coElem[4];        /* Object in each element.            */
  1373.   int coMode[3];        /* Objects in each sign mode.         */
  1374.   int coModeH[3];       /* Objects in each house mode.        */
  1375.   int coYang;           /* Objects in Fire/Air signs.         */
  1376.   int coYin;            /* Objects in Earth/Water signs.      */
  1377.   int coLearn;          /* Objects in first six signs.        */
  1378.   int coShare;          /* Objects in last six signs.         */
  1379.   int coAsc;            /* Objects in Eastern houses.         */
  1380.   int coDes;            /* Objects in Western houses.         */
  1381.   int coMC;             /* Objects in Southern houses.        */
  1382.   int coIC;             /* Objects in Northern houses.        */
  1383. } ET;
  1384.  
  1385. typedef struct _OrbitalElements {
  1386.   real ma0, ma1, ma2; /* Mean anomaly.           */
  1387.   real ec0, ec1, ec2; /* Eccentricity.           */
  1388.   real sma;           /* Semi-major axis.        */
  1389.   real ap0, ap1, ap2; /* Argument of perihelion. */
  1390.   real an0, an1, an2; /* Ascending node.         */
  1391.   real in0, in1, in2; /* Inclination.            */
  1392. } OE;
  1393.  
  1394. #ifdef WIN
  1395. #define nScrollDiv 24
  1396. #define nScrollPage 6
  1397. #define cchSzMaxFile 128
  1398. #define szFileTempCore "ASTROLOG.TMP"
  1399.  
  1400. typedef struct _WindowInternal {
  1401.   HWND hinst;     /* Instance of the Astrolog window class.    */
  1402.   HWND hwndMain;  /* The outer created frame window.           */
  1403.   HWND hwnd;      /* The current window being dealt with.      */
  1404.   HMENU hmenu;    /* The Astrolog main menu bar.               */
  1405.   HACCEL haccel;  /* Keyboard accelerator or shortcut table.   */
  1406.   HDC hdc;        /* The current DC bring drawn upon.          */
  1407.   HDC hdcPrint;   /* The current DC being printed upon.        */
  1408.   HWND hwndAbort; /* Window of the printing abort dialog.      */
  1409.   HPEN hpen;      /* Pen with the current line color.          */
  1410.   HBRUSH hbrush;  /* Fill if any with the current color.       */
  1411.   HFONT hfont;    /* Font of current text size being printed.  */
  1412.   UINT nTimer;    /* Identifier for the animation timer.       */
  1413.   short xScroll;  /* Horizontal & vertical scrollbar position. */
  1414.   short yScroll;
  1415.   short xClient;  /* Horizontal & vertical window size. */
  1416.   short yClient;
  1417.   int xChar;      /* Horizontal & vertical font character size. */
  1418.   int yChar;
  1419.   int xMouse;     /* Horitontal & vertical mouse position. */
  1420.   int yMouse;
  1421.   WORD wCmd;      /* The currently invoked menu command.        */
  1422.   int nMode;      /* New chart type to switch to if any.        */
  1423.   bool fMenu;     /* Do we need to repaint the menu bar?        */
  1424.   bool fMenuAll;  /* Do we need to redetermine all menu checks? */
  1425.   bool fRedraw;   /* Do we need to redraw the screen?           */
  1426.   bool fCast;     /* Do we need to recast the chart positions?  */
  1427.   bool fAbort;    /* Did the user cancel printing in progress?  */
  1428.   int nDlgChart;  /* Which chart to set in Open or Info dialog. */
  1429.  
  1430.   /* Window User settings. */
  1431.   bool fPause;       /* Is animation paused?                   */
  1432.   bool fBuffer;      /* Are we drawing updates off screen?     */
  1433.   bool fHourglass;   /* Bring up hourglass cursor on redraws?  */
  1434.   bool fChartWindow; /* Does chart change cause window resize? */
  1435.   bool fWindowChart; /* Does window resize cause chart change? */
  1436.   bool fNoUpdate;    /* Do we not automatically update screen? */
  1437.   KI kiPen;          /* The current pen scribble color.        */
  1438.   int nDir;          /* Animation step factor and direction.   */
  1439.   UINT nTimerDelay;  /* Milliseconds between animation draws.  */
  1440. } WI;
  1441. #endif
  1442.  
  1443. #include "extern.h"
  1444.  
  1445. /* astrolog.h */
  1446.